package IteratorPattern;

public class Main {
    public static void main(String[] args) {
        BookShelf bookShelf = new BookShelf(5);
        bookShelf.appendBook(new Book("NT1"));
        bookShelf.appendBook(new Book("NT2"));
        bookShelf.appendBook(new Book("NT3"));
        bookShelf.appendBook(new Book("NT4"));
        bookShelf.appendBook(new Book("NT5"));
        Iterator it = bookShelf.iterator();
        while(it.hasNext()){
            Book book = (Book) it.next();
            System.out.println(book.getName());
        }

    }
}
